package com.atguigu.seckill.config;

import com.atguigu.seckill.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author ShiJieLin
 * @Date 2022/5/4 15:51
 * @Version 1.0
 */
@Configuration
public class SeckillWebConfig implements WebMvcConfigurer {

    private final LoginInterceptor loginInterceptor;

    public SeckillWebConfig(LoginInterceptor loginInterceptor) {
        this.loginInterceptor = loginInterceptor;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor).addPathPatterns("/**");;
    }
}
